// pages/activity.js
var t = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    iconsUrl:t.globalData.iconsUrl,
    navHeight:t.globalData.navHeight,
    title:'会员活动',
    about_us:'',
    center_picture:'',
    user_agreement:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      userInfo:wx.getStorageSync('userInfo'),
    })
    this.getall();
    this.getsite();
  },
  onRefresh(){
    //在当前页面显示导航条加载动画
    wx.showNavigationBarLoading(); 
    //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
    this.getall();
  },
  onPullDownRefresh: function () {
    //调用刷新时将执行的方法
    this.onRefresh();
    setTimeout(function () {
      // 不加这个方法真机下拉会一直处于刷新状态，无法复位
      wx.stopPullDownRefresh()
    }, 1000)
  },
  getsite(){
    let that=this;
    t.request('/Users/getEntry',{},function(r){
          console.log(r.result);
          that.setData({
            about_us:r.result.about_us,
            center_picture:r.result.center_picture,
            user_agreement:r.result.user_agreement
          })
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },





  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  navigate:function(e){
    /*
    let page='/pages/article/article?id=' + e.currentTarget.dataset.id;
    wx.navigateTo({
      url: page
    })
    */
  },
  getall(){
    let that=this;
    t.request('/Users/getactivity',{},function(r){
          console.log(r.result);
          that.setData({
            list:r.result
          })
    })
  },

})